package org.easypool;


public class DataSourceConfig {

    private String url ;

    private String driverName;

    private String username;

    private String password;
    // 获取连接线程等待的时间
    private Integer GET_CONNECTION_WAIT_MAX_TIME = 2000;
    // 连接的寿命 (default 10s)
    private Integer CONNECT_ACTIVE_MAX_TIME = 2000;

    private Integer MAX_POOL_SIZE = 150;

    private final String PING_QUERY = "/* ping */";

    public DataSourceConfig url (String url) {
        this.url = url;
        return this;
    }

    public DataSourceConfig driverName (String driverName) {
        this.driverName = driverName;
        return this;
    }

    public DataSourceConfig username (String username) {
        this.username = username;
        return this;
    }

    public DataSourceConfig password (String password) {
        this.password = password;
        return this;
    }

    public DataSourceConfig GET_CONNECTION_WAIT_MAX_TIME (Integer GET_CONNECTION_WAIT_MAX_TIME) {
        this.GET_CONNECTION_WAIT_MAX_TIME = GET_CONNECTION_WAIT_MAX_TIME;
        return this;
    }

    public DataSourceConfig CONNECT_ACTIVE_MAX_TIME (Integer CONNECT_ACTIVE_MAX_TIME) {
        this.CONNECT_ACTIVE_MAX_TIME = CONNECT_ACTIVE_MAX_TIME;
        return this;
    }

    public DataSourceConfig MAX_POOL_SIZE (Integer MAX_POOL_SIZE) {
        this.MAX_POOL_SIZE = MAX_POOL_SIZE;
        return this;
    }

    public String getUrl() {
        return url;
    }

    public String getDriverName() {
        return driverName;
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    public Integer getGET_CONNECTION_WAIT_MAX_TIME() {
        return GET_CONNECTION_WAIT_MAX_TIME;
    }

    public Integer getCONNECT_ACTIVE_MAX_TIME() {
        return CONNECT_ACTIVE_MAX_TIME;
    }

    public Integer getMAX_POOL_SIZE() {
        return MAX_POOL_SIZE;
    }

    public String getPING_QUERY() {
        return PING_QUERY;
    }
}
